export default {
    name: 'dhTable',
    data(){

    },
    methods:{
        handleSelectionChange(val) {
            this.presentSelectList = val
            this.$emit('selectionChange', val)
        },

        handleSelection(selection, row) {
            this.$emit('selectionChange', selection, row)
        },
    },
    props:{
        tableDetail: Object,
    },

    template:`
        <el-table :data="tableDetail.tableData" style="width: 100%; margin-top: 10px" :max-height="tableDetail.tableLayout.height || '800px'" 
            @selection-change="handleSelectionChange" @select="handleSelection"
            >
            <el-table-column type="selection" width="55" v-if="tableDetail.tableLayout.selected"/>
            <el-table-column :fixed="item.fixed" :prop="item.prop" :label="item.label" :width="item.width || ''" v-for="(item,index) in tableDetail.tableLabel" align="center">
                <template #default="scope">
                    <slot :name="item.slotName" v-if="item.slotName" :scope="scope">
                        {{scope.row[item.prop]}}
                    </slot>
                </template>
            </el-table-column>

        </el-table>
    `
}